home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1984-04-24 | 3.4 KB | 70 lines |
- 10 ' COPYRIGHT 1982, RICHARD M. SCHINNELL
- 20 ' This Program is called CONV.BAS
- 30 ON ERROR GOTO 640
- 40 CLS:LOCATE 12,1
- 45 PRINT"COPYRIGHT 1982, Richard Schinnell Rockville,Maryland 301 949-8848 "
- 50 PRINT"This program will convert .COM files to a basic program which"
- 60 PRINT"you then can transmit to someone over the Telephone. They
- 70 PRINT"can then run the basic program and it will re-create the .COM pgm.
- 80 PRINT"just like you had it. E N J O Y RICH......":PRINT
- 90 INPUT "Name of the COM or EXE File to convert (<5001 Bytes )?: ";FIL1$
- 100 PRINT "To call the program with the same name with .BAS ext hit C/R"
- 110 INPUT "WHAT do you wish to call the basic program ?: ";FIL2$
- 120 IF LEN(FIL2$)<1 THEN FIL2$=MID$(FIL1$,1,(INSTR(FIL1$,".")-1))+".BAS"
- 130 RICH$="1000 DATA ":NUMLIN=1010:X=0:GRAND#=0:CNT=1
- 140 IF FIL1$=FIL2$ THEN CLS:LOCATE 12,15:PRINT "DUPLICATE FILE NAMES ":GOTO 10
- 150 OPEN FIL1$ FOR INPUT AS #1:CLOSE #1
- 160 OPEN FIL1$ AS #1 LEN=1 ' opening the .COM file
- 170 V= VARPTR(#1) ' looking at the FCB
- 180 L0=PEEK(V) ' getting the type of file
- 190 IF L0<>4 THEN 640 ' if file not random then abort
- 200 L1=PEEK(V+17) + 256 * PEEK(V+18) ' this gets the filesize in bytes
- 210 LIMIT = L1:IF LIMIT>5000 THEN GOTO 640 ' if it's too big then abort
- 220 OPEN FIL2$ FOR OUTPUT AS #2 ' opening up the .bas file this pgm creates
- 230 GOSUB 430
- 240 PRINT #2," 99 DATA ";STR$(LIMIT)
- 250 FIELD #1,1 AS GETS$
- 260 X =X +1:IF X =< LIMIT THEN GET #1,X ELSE 360
- 270 RICH1$=STR$(ASC(GETS$))
- 280 IF CNT <13 THEN RICH$=RICH$+MID$(RICH1$,2,LEN(RICH1$)-1)+",":CNT=CNT+1:GRAND#=GRAND#+ASC(GETS$):GOTO 260
- 290 GOTO 360
- 300 LOCATE 20,5:PRINT "total ASCII count is ";GRAND#
- 310 PRINT #2,"5000 PRINT ";CHR$(34);"* * ERROR VERIFY DATA * * * ";CHR$(34)
- 320 PRINT #2,"5010 CLOSE:END"
- 330 LOCATE 18,1:PRINT SPC(78);:LOCATE 18,1:PRINT RICH$;
- 340 LOCATE 20,1:PRINT" You have sucessfully created file named ";FIL2$
- 350 CLOSE:END
- 360 RICH$=LEFT$(RICH$,(LEN(RICH$)-1))
- 370 CNT=1:PRINT #2,RICH$:NUMLIN=NUMLIN+1
- 380 LOCATE 18,1:PRINT SPC(78);:LOCATE 18,1:PRINT RICH$;
- 390 IF X = LIMIT+1 THEN PRINT #2, RIGHT$(STR$(NUMLIN),4);" DATA ";STR$(GRAND#):GOTO 310
- 400 LIN$=RIGHT$(STR$(NUMLIN),4)
- 410 RICH$=LIN$+" DATA "+MID$(RICH1$,2,LEN(RICH1$)-1)+",":GRAND#=GRAND#+ASC(GETS$)
- 420 GOTO 260
- 430 PRINT #2," 1 CLS:PRINT ";CHR$(34);"THIS basic PROGRAM WAS AUTOMATICALLY CREATED BY CONVERT.BAS";CHR$(34)
- 440 PRINT #2," 2 PRINT";CHR$(34);"Copyright 1982 ,Rich Schinnell Rockville,MD. Not for Sale.";CHR$(34)
- 450 PRINT #2," 3 PRINT ";CHR$(34);"This program will automatically generate you a .COM program named ";FIL1$;CHR$(34);":PRINT "
- 460 PRINT #2," 4 ON ERROR GOTO 5000"
- 465 PRINT #2," 6 INPUT ";CHR$(34);"The file will be saved on the default drive.Place disk in the drive then Strike any key ";CHR$(34);"; SCHINNELL$"
- 470 PRINT #2," 9 PRINT:PRINT ";CHR$(34);" Now reading the data statements, wait!";CHR$(34)
- 480 PRINT #2," 10 RESTORE:READ T:FOR I = 1 TO T:READ N:X#=X#+N:NEXT I"
- 490 PRINT #2," 20 READ TOT# :IF TOT#<>X# THEN 5000"
- 500 PRINT#2," 22 CLS:LOCATE 12,5:PRINT ";CHR$(34);"Now writing file NAMED ";FIL1$;" standby please ";CHR$(34)
- 510 PRINT #2," 30 RESTORE"
- 520 IF INSTR(FIL1$,":")=2 THEN FIL3$=MID$(FIL1$,3,13) ELSE FIL3$=FIL1$
- 530 PRINT #2," 40 OPEN ";CHR$(34);"R";CHR$(34);", #1,";CHR$(34);FIL3$;CHR$(34);",1 "
- 540 PRINT #2," 50 FIELD #1, 1 AS N$
- 550 PRINT #2," 60 READ N"
- 560 PRINT #2," 70 FOR I = 1 TO N
- 570 PRINT #2," 80 READ N:LSET N$=CHR$(N):
- 580 PRINT #2," 92 PUT #1 :NEXT I:CLOSE"
- 590 PRINT #2," 94 PRINT ";CHR$(34); FIL3$;" CREATED * *";CHR$(34);":GOTO 5010"
- 600 CLS:LOCATE 12,5:PRINT "I am now reading file named ";FIL1$
- 610 LOCATE 14,5:PRINT "I am now writing file named ";FIL2$
- 620 LOCATE 16,5:PRINT "the file size of the input file is ";LIMIT
- 630 RETURN
- 640 PRINT " you had an error ";ERR;" in line # ";ERL
- 650 PRINT "Probably you named a file which does not exist "
- 660 PRINT "try again Charlie........
- 670 END
-